
<!-- 资产关系管理 -->
<template>
    <div class="page">
        <div class="nuclein-query">
            <div>资产关系管理</div>
            <div style="margin-left: auto;">
                <!-- <el-button size="mini" type="primary" style="opacity: 0;">添加</el-button> -->
            </div>
        </div>
        <div class="content-row">
            <el-table :data="tableData" style="width: 100%" border>
                <el-table-column prop="estateId" label="资产id" align="center">
                </el-table-column>
                <el-table-column prop="estateName" label="资产名称" align="center">
                </el-table-column>
                <el-table-column prop="count" label="设备数量" align="center">
                </el-table-column>
            </el-table>
        </div>
        <!-- 分页 -->
        <div class="pagination">
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"
                :page-sizes="[10, 20, 30, 40]" :page-size="limit" layout="total, sizes, prev, pager, next, jumper"
                :total="total">
            </el-pagination>
        </div>
    </div>
</template>

<script>
import { assetsShip } from '../../api/api'
import commonFunction from '../../utils/commonFunction'
export default {

  data () {
    return {
      total: 10,
      page: 1,
      limit: 10,
      tableData: []
    }
  },
  created () {
    this.gitList()
  },
  methods: {
    // 获取
    gitList () {
      const data = {
        page: this.page,
        size: this.limit
      }
      assetsShip({ ...data }).then(res => {
        if (res.code == 0) {
          const { total, records } = res.page
          this.tableData = records
          this.total = total
        } else {
          this.$message.error(res.msg)
        }
      })
    },
    // 分页
    handleSizeChange (val) {
      this.limit = val
      this.gitList()
    },
    handleCurrentChange (val) {
      this.page = val
      this.gitList()
    }
  }
}
</script>

<style scoped>
.page {
    position: relative;
    height: 100%;
}

.nuclein-query {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #DCDFE6;
}

.content-row {
    overflow: hidden;
}

/* 分页 */
.pagination {
    width: 100%;
    padding: 20px;
    border-top: 1px solid #DCDFE6;
}
</style>
